# $Id$
# Maintainer (ArchLinux): Alexander Rødseth <rodseth@gmail.com>
# Contributor (ArchLinux): William Rea <sillywilly@gmail.com>
# Contributor (ArchLinux): Stefan Husmann <stefan-husmann@t-online.de>
# Maintainer (MSYS2): Ray Donnelly <mingw.android@gmail.com>

_realname=arpack
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.3.0
pkgrel=1
arch=('any')
pkgdesc='Fortran77 subroutines designed to solve large scale eigenvalue problems (mingw-w64)'
url='http://forge.scilab.org/index.php/p/arpack-ng/'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-openblas")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-fortran")
provides=("${MINGW_PACKAGE_PREFIX}-arpack-ng")
source=(#"http://forge.scilab.org/upload/$_realname-ng/files/$_realname-ng_${pkgver}.tar.gz"
        ${_realname}-${pkgver}.tar.gz::https://github.com/opencollab/arpack-ng/archive/${pkgver}.tar.gz)
sha256sums=('ad59811e7d79d50b8ba19fd908f92a3683d883597b2c7759fdcc38f6311fe5b3')

prepare() {
 cd "${srcdir}/${_realname}-ng-${pkgver}"
 ./bootstrap
}

build() {
  [ -d "${srcdir}"/build-${CARCH} ] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  ../${_realname}-ng-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --with-blas=openblas \
    --disable-mpi

  make F77="gfortran"
}

check() {
  cd "${srcdir}"/build-${CARCH}
  make check
}

package() {
  cd "${srcdir}"/build-${CARCH}

  make DESTDIR="${pkgdir}"/ install
  install -Dm644 ${srcdir}/${_realname}-ng-${pkgver}/COPYING \
    ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}

# vim:set ts=2 sw=2 et:
